#!/usr/bin/node

//引用模块
const http = require('http');

//创建服务
const server = http.createServer((req, res) => {
  //获取HTTP响应的状态码
  res.statusCode = 200;
  //设置HTTP响应的头部字段
  res.setHeader('Content-type', 'text/plain')
  res.end('Hello world!');
});

server.listen(8080, () => {
  console.log('Server running at http://localhost:8080/');
});